package com.mes.basicdata.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;

@Entity()
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "F_FILE_FIELD")
@BatchSize(size=30)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class FileObjectRelation extends BasicModel implements
		java.io.Serializable {
	
	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name="UNIQUEID",unique=true)
	private String uniqueId;
	
	// 文件唯一号
	@Column(name="FILEUID")
	private String fileUid;
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="FILEUID",insertable=false,updatable=false)
	private FileObject file;
		
	// 对象唯一号
	@Column(name="FIELDUID")
	private String objectUid;
	
	// 对象类型
	@Column(name="FIELDTYPE")
	private String objectType;
	
	// 是否有效
	@Column(name="EFFECTIVE")
	private Boolean effective;
	
	
	public FileObjectRelation() {
		// TODO Auto-generated constructor stub
	}
	
	
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getUniqueId();
	}
	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setUniqueId(uuid);
	}
	
	public String getUniqueId() {
		return uniqueId;
	}
	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	public String getFileUid() {
		return fileUid;
	}
	public void setFileUid(String fileUid) {
		this.fileUid = fileUid;
	}

	public FileObject getFile() {
		return file;
	}
	public void setFile(FileObject file) {
		this.file = file;
	}

	public String getObjectUid() {
		return objectUid;
	}
	public void setObjectUid(String objectUid) {
		this.objectUid = objectUid;
	}

	public String getObjectType() {
		return objectType;
	}
	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}

	public Boolean getEffective() {
		return effective;
	}
	public void setEffective(Boolean effective) {
		this.effective = effective;
	}
	
	
}